// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import elementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(elementUI)
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>',
  mounted(){
    //导航守卫，控制加载进度条
    router.beforeEach((to,form,next)=>{
      this.$store.commit('changeLoadingBarActive',true)
      this.$store.commit('changeLoadingBarHidden',true)
      next()
    })
    router.afterEach((to,form,next)=>{
      setTimeout(()=>{
        this.$store.commit('changeLoadingBarActive',false)
      },2500)
    })
  }
})



